import type {InjectionKey} from 'vue'
import type {GoodsFormOption,LayoutFormModelValueItem,GoodsFormContentPrice} from '@/typings'

export interface GoodsLayoutFormItemContext {
    info:GoodsFormOption
    message: string
    form:LayoutFormModelValueItem
    totalPrice?:number
}

export interface GoodsLayoutContext {
    // expose
    addField: (field: GoodsLayoutFormItemContext) => void
    removeField: (field: GoodsLayoutFormItemContext) => void
    disabled?:boolean
    getPrice:(item: GoodsFormContentPrice,quantity?:string|number)=>number
}

export const goodsLayoutFormContextKey: InjectionKey<GoodsLayoutContext> =
    Symbol("GoodsLayoutFormContextKey");